/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
 *
 */

import path from 'path';

import { BuildDirConst } from '../../const/build-directory-const.js';
import { CommonConst } from '../../const/common-const.js';
import { AppJson } from '../../options/configure/app-json-options.js';
import { resModelLoader } from '../../utils/loader/file/res-model-loader.js';

import { CoreResModelImpl } from './core-res-model-impl.js';
import { AppRes } from './res-model.js';

/**
 * Stage模型的App级别的资源
 *
 * @since 2022/2/23
 */
export class AppResModelImpl extends CoreResModelImpl implements AppRes {
  constructor(sourceSetRoot: string) {
    super(path.resolve(sourceSetRoot, CommonConst.APP_CONFIG), path.resolve(sourceSetRoot, BuildDirConst.RESTOOL_BUILD_RESOURCES));
  }

  getAppResOpt(): AppJson.AppOptObj {
    return resModelLoader.getAppJson(this.getJsonPath());
  }
}
